//var plog = require("./plog");
//var plib = require("./plib");


module.exports.Msg = function(_app, _channelname, _rid, _msgname, _msg) {
	var _channelServer = _app.get('channelService');
	var channel = _app.get('channelService').getChannel(_channelname, false);
	var mlist = new Array();
	//plog.out(plib.objdump(channel.getMember(_rid)));
	var mm = channel.getMember(_rid);
	if(mm !=  null){
	mlist.push({
		uid:_rid, 
		sid:mm['sid']});
	_channelServer.pushMessageByUids(_msgname, _msg, mlist);
	}

}
module.exports.pushOneMessage = function(_channelServer, _channelname, _rid, _msgname, _msg) {
	var channel = _channelServer.getChannel(_channelname, false);
	if(channel == null)
	{ plog.out("error, can not find the channel");
	}
	var mlist = new Array();
	//plog.out(plib.objdump(channel.getMember(_rid)));
	var mm = channel.getMember(_rid);
	if(mm !=  null){
	mlist.push({
		uid:_rid, 
		sid:mm['sid']});
	_channelServer.pushMessageByUids(_msgname, _msg, mlist);
	}
};

